public class Demo46 {
    public static void main(String[] args) throws InterruptedException {
        Object locker=new Object();
        Thread t1=new Thread(()->{
            synchronized (locker){
                System.out.println("hello t1");
                try {
                    Thread.sleep(3000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        });
        Thread t2=new Thread(()->{
            synchronized (locker){
                System.out.println("hello t2");
            }
        });
        t1.start();
        Thread.sleep(100);
        t2.start();
        Thread.sleep(500);
        System.out.println(t2.getState());
    }
}
